<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 300px;
            background-color: rgba(0,0,0,0.3);

            /*下面的文字和输入框是一个整体！！所以四周的内边距都是10px*/
            padding: 10px;
            position: relative;
        }
        input{
            border: none;
            padding: 10px 20px;
            width: 300px;
            /*不设置的话白色部分就从右边出去了*/
            box-sizing: border-box;

        }
        p{
            color: red;
            font-size: 12px;
            margin: 0;
        }

        img{
            position: absolute;
            /*设置为0就紧贴div了（灰色边）*/
            top: 14px;
            right: 30px;
        }


    </style>
</head>
<body>
<div>
    <input type="text" placeholder="请输入用户名">
    <img src="http://doc.canglaoshi.org/tstore_v1/images/login/yhm.png" alt="">
    <p>用户名不能为空!</p>

</div>
</body>
</html>